package com.pug.zixun.commons.ex;

/**
 * @Description:
 * @Author: WengYu
 * @CreateTime: 2022/05/18 23:27
 */
public class ErrorHandler {
    /**
     * 状态码
     */
    private Integer code;
    /**
     * 错误名称
     */
    private String message;
    /**
     * 异常名字
     */
    private String exception;


    private ErrorHandler(Integer code, String message, String exception){
        this.code = code;
        this.message = message;
        this.exception = exception;
    }
    public static ErrorHandler fail(Integer code,String message, Throwable throwable) {
        return new ErrorHandler(code,message, throwable.getClass().getName());
    }

    public String getException() {
        return exception;
    }

    public void setException(String exception) {
        this.exception = exception;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }


}
